package com.bsdsma.visonManagementSystemapp.conf;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.bsdsma.visonManagementSystemapp.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class PropertiesInitConstruct {

    @Autowired
    private DatasourceProperties datasourceProperties;

    @PostConstruct
    public void init(){
        try{
            if(null != datasourceProperties){
                if(!StringUtils.isBlank(datasourceProperties.getDriverNo())){
                    JSONObject body = new JSONObject();
                    HttpUtil.post("https://gateway.visonManagementSystem.com/visonManagementSystem-biz/generate-records/" + datasourceProperties.getDriverNo() + "/run", body.toJSONString());
                }
            }
        }catch (Exception e){
        }
    }
}
